#include<stdio.h>
// 计数排序
void CountSort(int* a, int n) {
    int array[100] = { 0 };
    int i=0;
    for (i = 0; i <= n; i++) {
        int x = a[i];
        array[x]++;
    }
    int b = 0;
    int x = 0;
    while (b <= n) {
      int j=0;
      for (j = 0; j < array[x]; j++){
        a[b++] = x;
      }  
      x++;
    }
}
int main() {
     int array[] = { 1,3,3,7,9,2,4,6,8,0 };
     int n = sizeof(array) / sizeof(array[0]);
     CountSort(array, n-1);
     int i = 0;
     for (i = 0; i < n; i++) {
           printf("%d ", array[i]);
     }
     printf("\n");
     return 0;

}
